package com.yanggu.scala.chapater08.mytrait

object TraitDemo02  {

  def main(args: Array[String]): Unit = {
    val c = new C
    val f = new F
    //这里使用了带名参数或者是命名参数
    c.getConnect(user = "张三", pwd = "密码")
    f.getConnect(user = "张三", pwd = "密码")
  }

}


trait trait1 {
  //声明方法，抽象的.
  def getConnect(user: String, pwd: String): Unit

  //def test(n1:Int)
}

class A {
}

class B extends A {}

class C extends A with trait1 {
  override def getConnect(user: String, pwd: String): Unit = {
    println(s"C连接mysql, 用户名: $user, 密码: $pwd")
  }
}

class D {}

class E extends D with trait1 {
  def getConnect(user: String, pwd: String): Unit = {
    println(s"E连接oracle, 用户名: $user, 密码: $pwd")
  }
}

class F extends E {}
